package server.controller.recordController;

import server.model.factory.ModelFactory;
import server.util.InfoUtils.Info;
import server.util.InfoUtils.InfoEnum;
import server.util.InfoUtils.InfoUtil;
import server.util.MyUtils;
import server.util.ResponseUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//获取购买记录
@WebServlet("/getRecordOfUser")
public class GetRecordOfUserServlet extends HttpServlet {
    private static final long serialVersionUID = 960451883491275470L;

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Integer userId = (Integer) req.getAttribute("userId");

        Info info = ModelFactory.getRecordModel().getRecordOfUser(userId);
        ResponseUtil.responseMessage(resp, info, 2);
    }
}